<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 100px;
      height: 100px;
      background-color: green;
    }
  </style>
</head>

<body>
  <div class="box"></div>
  <script>
    let box = document.querySelector('.box');
    function fn1(elBox) {
      return new Promise((resolve, rejected) => {
        setTimeout(() => { //延时移动才看到得过程。
          console.log("fn1");
          elBox.style.transform = "translate(500px,0)"
          resolve()
        }, 1000);
      })

    }
    function fn2(elBox) {
      return new Promise((resolve, rejected) => {
        setTimeout(() => {
          console.log("fn2");
          elBox.style.transform = "translate(500px,500px)"
          resolve();
        }, 1000);
      })

    }
    function fn3(elBox) {
      return new Promise((resolve, rejected) => {
        setTimeout(() => {
          console.log("fn3");
          elBox.style.transform = "translate(0,500px)"
          resolve();
        }, 1000);
      })

    }
    function fn4(elBox) {
      return new Promise((resolve, rejected) => {
        setTimeout(() => {
          console.log("fn4");
          elBox.style.transform = "translate(0,0)"
          resolve();
        }, 1000);
      })

    }
    fn1(box).then(() => {
      return fn2(box)
    }).then(() => {
      return fn3(box)
    }).then(() => {
      return fn4(box)
    })

  </script>
</body>

</html>